package ru.kruzhki.client.gin;

import ru.kruzhki.client.gwtp.GwtpUtil;
import ru.kruzhki.client.place.ClientPlaceManager;
import ru.kruzhki.client.place.DefaultPlace;
import ru.kruzhki.client.place.NameTokens;
import ru.kruzhki.client.ui.addcompany.AddCompanyPresenter;
import ru.kruzhki.client.ui.addcompany.AddCompanyView;
import ru.kruzhki.client.ui.main.MainPagePresenter;
import ru.kruzhki.client.ui.main.MainPageView;
import ru.kruzhki.client.ui.searchform.SearchFormPresenter;
import ru.kruzhki.client.ui.searchform.SearchFormView;
import ru.kruzhki.client.ui.searchresults.SearchResultsPresenter;
import ru.kruzhki.client.ui.searchresults.SearchResultsView;

import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.gwtplatform.mvp.client.gin.DefaultModule;

public class ClientModule extends AbstractPresenterModule {

	@Override
	protected void configure() {
		install(new DefaultModule(ClientPlaceManager.class));

		bindPresenter(MainPagePresenter.class, MainPagePresenter.MyView.class, MainPageView.class, MainPagePresenter.MyProxy.class);
		bindPresenter(AddCompanyPresenter.class, AddCompanyPresenter.MyView.class, AddCompanyView.class, AddCompanyPresenter.MyProxy.class);
		bindSingletonPresenterWidget(SearchFormPresenter.class,SearchFormPresenter.MyView.class , SearchFormView.class);

		bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.main);

		bindPresenter(SearchResultsPresenter.class, SearchResultsPresenter.MyView.class,
				SearchResultsView.class, SearchResultsPresenter.MyProxy.class);
		bind(GwtpUtil.class).asEagerSingleton();
	}
}
